/*
 App configuration
 */

define([
    "libs/core",
    "helpers/menu",
    "helpers/locale",
    "helpers/theme",
    "libs/rollbar",
    "helpers/network",
    // "helpers/constant"
], function (core, menu, locale, theme, tracker, network) {

    String.prototype.toApiUrlImageSrcContent = function () {
        return this.replace(/src="[a-z.:\/0-9]*\/file\/ueditor/g, 'src="' + network.url.imgUrl + '/file/ueditor').replace(/src="[a-z.:\/0-9]*\/file\/public\/uploads\/ueditor/g, 'src="' + network.url.imgUrl + '/file/public/uploads/ueditor');
    };
    //webix.codebase = "libs/webix/";
    //CKEditor requires full path
    webix.codebase = document.location.href.split("#")[0].replace("index.html", "") + "libs/webix/";

    if (!webix.env.touch && webix.ui.scrollSize && webix.CustomScroll)
        webix.CustomScroll.init();


    if (webix.production)
        tracker.init({
            accessToken: '650b007d5d794bb68d056584451a57a8',
            captureUncaught: true,
            source_map_enabled: true,
            code_version: "0.8.0",
            payload: {
                environment: 'production'
            }
        });

    //configuration
    var app = core.create({
        id: "admin-console",
        name: "admin-console",
        version: "0.1",
        debug: true,
        start: "/app/dashboard"
    });

    // app.use(menu);
    // app.use(locale);
    app.use(theme);

    return app;
});